#ifndef SCHEDULEITEM_H
#define SCHEDULEITEM_H

#include <QtGui>

#include "Period.h"
#include "PeriodDialog.h"
#include "Slot.h"

class ScheduleItem : public QGraphicsObject
{
	Q_OBJECT

public:
	ScheduleItem( int id, int program, int faculty, int room, int course );
	virtual ~ScheduleItem();

	inline int id(){ return mId; }
	inline int program(){ return mProgram; }
	inline int faculty(){ return mFaculty; }
	inline int room(){ return mRoom; }
	inline int course(){ return mCourse; }

	// Graphics Item
	//! returns the bounding rectangle
	inline QRectF boundingRect() const { return boundRect; }
	//! Paints the item.
    void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget );
	//! Called when the user double clicks on the item.
	void mouseDoubleClickEvent( QGraphicsSceneMouseEvent* event );
	//! Called when the user clicks on a item.
	void mousePressEvent( QGraphicsSceneMouseEvent* event );

	void addPeriod( Period* period );
	void addSlot( Slot* slot );

private slots:
	void selectPeriod( Period* period );
	void activatePeriod( Period* period );

private:
	int mId;
	int mProgram;
	int mFaculty;
	int mRoom;
	int mCourse;
	QList<Slot*> mSlots;
	QList<Period*> mPeriods;

	// Graphics Item
	QRectF boundRect;
};

#endif // SCHEDULEITEM_H